/*
 * @Author: your name
 * @Date: 2021-08-30 15:39:59
 * @LastEditTime: 2021-08-30 15:56:27
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \briup\Web课后练习成果\ES5\数组排列（升序）.js
 */
//如何实现数组升序排列？例如：var arr = [8, 19, 3, 12, 5, 4]
//new一个数组arr并给它赋值
var arr = new Array(8, 19, 3, 12, 5, 4);
// console.log(arr);
//使用sort自定义排序方式
function compare(v1, v2) {
    var result = v1 - v2;
    return result;
}
console.log(arr.sort(compare));